<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="com.zhufei.entity.*" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>图片新闻管理</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<style type="text/css">
<!--
body,td,th {
	font-size: 13px;
}
.picNewsImage{width:200px; height:100px; border-bottom:1px dashed #ccc; padding-bottom:8px; margin-left:14px; margin-top:14px;}
-->

</style>
	</head>

	<body>
		<table width="99%" border="5" align="center" cellpadding="5"
			cellspacing="5" bordercolor="#CCCCCC" bgcolor="#FFFFFF">
			<tr>
				<td height="16" background="admin/images/topbg.gif"
					bgcolor="#F7F7F7">
					<span class="STYLE1"> <img src="admin/images/pic5.gif"
							width="28" height="22" />您现在所在的位置是： <a
						href="admin/adminIndex.jsp">管理首页</a> -&gt;<strong><font
							color="red">图片展示管理</font> </strong> </span>
				</td>
			</tr>
			<tr>
				<td colspan="2" bgcolor="#FFFFFF">
			    <form action="PicNewsServlet?action=add" method="post" enctype="multipart/form-data"
						name="form1">
						<br>

					<table width="85%" height="56" border="2" align="center" cellpadding="1"
							cellspacing="1" bordercolor="#FFFFFF" bgcolor="#CCCCCC">
						<tr align="center" bgcolor="#F7F7F7" height="20">
							<td width="21%" height="25" background="images/topbg.gif"> 图片标题</td>
							<td width="34%" background="images/topbg.gif">匹配新闻ID</td>
							<td width="37%" background="images/topbg.gif">图片</td>
							<td width="8%" background="images/topbg.gif">
								操作
							</td>
					    </tr>
					    <%
					    	ArrayList<HomePageImage> picNewsList = (ArrayList<HomePageImage>)session.getAttribute("picNewsList");
					    	int pageRecord = (Integer)session.getAttribute("page_record");
					    	int curPages =(Integer)session.getAttribute("current_page");
					    	int totalPages = (Integer)session.getAttribute("total_page");

					    	for(int i = (curPages-1) * 10,j = 0 ; i < picNewsList.size() && j < pageRecord ; i++,j++){
					    	HomePageImage picNews  = picNewsList.get(i);
					     %>
						<tr align="center" bgcolor="#F7F7F7" height="20">
							<td height="25" background="images/topbg.gif"><%=picNews.getTitle()%></td>
							<td height="25" background="images/topbg.gif"><%=picNews.getUrl() %></td>
							<td background="images/topbg.gif">
							<div class="showPic">
							
							<img class="picNewsImage" src="<%=picNews.getImage_path() %>" />
							</div>
							</td>
							<td background="images/topbg.gif">
							  <a href="PicNewsServlet?action=delete&id=<%=picNews.getID()%>">删除</a>						    </td>
						</tr>
						<%
								}
						%>
				    </table>
				  </form>

	<table width="85%" border="2" align="center" cellspacing="0"
						bordercolor="#FFFFFF" bgcolor="#CCCCCC">
						<tr bgcolor="#F7F7F7">
							<td width="632" background="images/topbg.gif">
								<p align="center">
									<a href="newsServlet?action=manage">首页</a>
									<%
										if (curPages > 1) {
									%>
									
									<a href="newsServlet?action=manage&&page=<%=curPages - 1%>">上一页</a>
									<%
										}
									%>
									<%
										if (curPages < totalPages) {
									%>
									
									<a href="newsServlet?action=manage&&page=<%=curPages + 1%>">下一页</a>
									<%
										}
									%>
									<a href="newsServlet?action=manage&&page=<%=totalPages%>">尾页</a>
									
									共<%=totalPages%>页
								</p>
							</td>
						</tr>
					</table>
					<br>
				</td>
			</tr>
		</table>
		<br>
		<br>
	</body>
</html>
